<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">

    <meta name="description" content="A Christmas tree built out of form elements."/>
    <meta name="author" content="Hakim El Hattab"/>

    <meta http-equiv="X-UA-Compatible" content="chrome=1">

    <title>圣诞树</title>

    <link href="css/domtree.css" rel="stylesheet" media="screen"/>

    <link href='http://fonts.googleapis.com/css?family=Armata' rel='stylesheet' type='text/css'>

</head>
<body>
<header>
    <p style="text-align:center; font-size: 20px">李乐怡 画一颗圣诞树 to 董诗怡！祝你天天开心~</p>

    <div class="share">
        <div class="plusone">
            <div class="g-plusone" data-size="medium"></div>
        </div>
    </div>
</header>

<div class="tree"></div>
<audio src="shengdanjie.mp3" muted autoplay loop id="myaudio" style="display: none"></audio>
<script>
    /*
    * muted 静音
    * autoplay 自动播放
    * loop 循环播放
    */
    var audio = document.getElementById('myaudio');
    var t1 = 3e3;//如果是轮询，这个时间必须大于音频的长度。如果是webscoket，应该设置一个状态play，避免重复播放，如下：
    var t2 = 210*1000;//音频的长度，确保能够完整的播放给用户
    var play = false;
    function run(){
        if(play){
            return false;
        }
        audio.currentTime = 0;//设置播放的音频的起始时间
        audio.volume = 0.5;//设置音频的声音大小
        audio.muted = false;//关闭静音状态
        play = true;
        setTimeout(function(){
            play = false;
            audio.muted = true;//播放完毕，开启静音状态
        },t2);
    }
    setInterval(function(){
        run();//假装在轮询服务器，或者从websocket拉取数据
    },t1);
</script>

<audio id="success_music" src="shengdanjie.mp3" preload="auto"></audio>
<script src="js/domtree.js"></script>

<!-- Third party tracking and sharing code below -->

<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-15240703-1']);
    _gaq.push(['_trackPageview']);

    (function () {
        var ga = document.createElement('script');
        ga.type = 'text/javascript';
        ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(ga, s);
    })();
</script>

<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>

</body>
</html>